import java.util.Scanner;

public class Number {
    public static void main(String[] args) {
        Scanner num = new Scanner(System.in);
        int n = num.nextInt();
        System.out.println(remainder(n));
    }

    /**
     * 求一个数各位数之和
     * @param n
     * @return
     */
    public static int remainder(int n) {
/*        Integer a = (Integer) n;
        String s = a.toString();
        for (int i = 1; i <= s.length(); i++) {
        }*/
        int sum = 0;
        while (n > 0) {
            sum += n % 10;
            n /= 10;
        }
        return sum;
    }
}
